package team.pwy.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import team.pwy.pojo.entity.TicketOrder;

@Repository
public interface TicketMapper {


    @Insert("insert into pwy.pwy_ticket_order (user_id,order_number,create_time ,order_price,out_request_no) values (#{userId},#{orderNumber},NOW(),#{orderPrice},#{outRequestNo})")
    Integer addTicOrd(@Param("userId")Integer userId,@Param("orderNumber") String orderNumber,@Param("orderPrice") String orderPrice,@Param("outRequestNo") String outRequestNo);

    @Update("update pwy.pwy_ticket_order set status = 1,trade_no = #{tradeNo} where order_number = #{orderNumber}")
    Integer updateByOrdNum(String orderNumber,String tradeNo);

    @Select("select * from pwy.pwy_ticket_order where order_number = #{orderNum}")
    TicketOrder findByOrderNum(String orderNum);

    @Update("update pwy.pwy_ticket_order set status = 10 where order_number = #{orderNumber}")
    Integer updateByON(String orderNumber);
}
